<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <meta name="renderer" content="webkit">
    <title>课程管理</title>
    <link rel="stylesheet" href="__ADMIN__/css/pintuer.css">
    <link rel="stylesheet" href="__ADMIN__/css/admin.css">
    <script src="__ADMIN__/js/jquery.js"></script>
    <script src="__ADMIN__/js/pintuer.js"></script>
</head>
<body>
<div class="panel admin-panel">
    <div class="panel-head"><strong class="icon-reorder">导航信息列表</strong></div>
    <div class="padding border-bottom">
        <a class="button border-main" href="{:url('admin/course/add')}"><span class="icon-plus-square-o"></span> 添加课程</a>
    </div>
    <table class="table table-hover text-center">
        <tr>
            <th width="5%">课程ID</th>
            <th>课程名称</th>
            <th></th>

            <th width="250">操作</th>
        </tr>
        {volist name="data" id="vo"}
        <tr>
            <td>{$vo.id}</td>
            <td>{$vo.name}</td>
            <td>
                <div class="button-group">
                    <a type="button" class="button border-main" href="{:url('admin/course/edi',['id'=>$vo.id] ) }"><span class="icon-edit"></span>修改</a>
                    <a class="button border-red"  onclick="del('{$vo.id}')"><span class="icon-trash-o"></span> 删除</a>
                </div>
            </td>
        </tr>
        {/volist}
        <tr>
            <td colspan="8">

            </td>
        </tr>
    </table>

</div>
<script>
    function del(id){
        if(confirm("您确定要删除吗?")){
            $.ajax({
                type : "POST",
                url : "{:url('admin/course/del')}",
                data : {'id':id},
                dataType :'json',
                success:function (res) {
                    if(res.status==1){
                        alert(res.msg);
                        location.reload();
                    }else{
                        alert(res.msg);
                    }

                },
                error:function (data) {
                    console.log('error');
                },
            })
        }else{
            return false;
        }
    }

</script>
</body></html>